from django import forms
import models

class CaipsRequestForm(forms.Form):
    email = forms.EmailField()
    file_no = forms.CharField(max_length=15,)
    first_name = forms.CharField(max_length=45)
    last_name = forms.CharField(max_length=45)
    birthdate = forms.DateField()

    office_name = forms.ModelChoiceField(queryset=models.VisaOffice.objects.all(),
                                         empty_label=u'Please select')

    #middle_name = forms.CharField(max_length=45)
    #client_id = forms.CharField(max_length=45)
    
    def __init__(self, *args, **kwargs):
        super(CaipsRequestForm, self).__init__(*args, **kwargs)
        #self.fields['office_name'].widget.attrs['class'] = 'textinput'
    
    def save(self):
        new_caips_request = models.CaipsRequest.objects.create()
        return new_caips_request
